package com.springboot.dubbo.provider.filter;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.extension.Activate;
import com.alibaba.dubbo.rpc.*;

/**
 * @Author: guodong
 * @Date: 2020/12/30 13:21
 * @Version: 1.0
 * @Description:
 */
@Activate(group = {Constants.PROVIDER})
public class DubboProviderTestFilter implements Filter {


    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {

        String name = RpcContext.getContext().getAttachment("name");

        String age = RpcContext.getContext().getAttachment("age");

        System.out.println("name=" + name + ", age= " + age);
        return invoker.invoke(invocation);
    }




}
